<template>
	<view class="container">
		<uni-section title="编号" sub-title="" type="square">
				{{data.id}}
			</uni-section>
			<uni-section title="同学姓名" sub-title="" type="square">
				{{data.name}}
			</uni-section>
			<uni-section title="学院" sub-title="" type="square">
				{{data.department}}
			</uni-section>
			<uni-section title="专业" sub-title="" type="square">
				{{data.major}}
			</uni-section>
			<uni-section title="电话" sub-title="" type="square">
				{{data.telephone}}
			</uni-section>
			<uni-section title="邮箱" sub-title="" type="square">
				{{data.email}}
			</uni-section>
			<button class="button" @click="toComment" type="primary" style="width: 90%;">去评论</button>
			<button class="button" @click="gocomment" type="primary" style="width: 90%;">查看评论</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: {
					"id": 1,
					"name": "张三",
					"password": "123",
					"email": "zs@163.com",
					"telephone": "15116785432",
					"department": "信息工程学院",
					"major": "移动应用开发"
				}
			}
		},
		methods: {
			onLoad(option) {
				let id = option.id
				uni.request({
					url: 'http://localhost:8090/freshmenapp/classmate/findone',
					method: 'POST',
					data: {
						id: id
					},
					success: res => {
						this.stu = res.data.data
					},
					fail: () => {
						uni.showToast({
							title: '失败',
							icon: 'none'
						})
			
					},
					complete: () => {}
				});
			},
			onShow() {},
			toComment(name) {
				uni.navigateTo({
					url: "../comment/comment?name=" + name
				})
			},
			gocomment(name) {
				uni.navigateTo({
					url: "../commentlist/commentlist?name=" + name
				})
			}
		},
	}
</script>

<style>

</style>
